package entity;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Product implements java.io.Serializable {

	private static final long serialVersionUID = 5898658903410328768L;
	// Fields
	/** id */
	private int id;
	private String productName;
	private String description;
	private Long addTime;
	private Double fixedPrice;
	private Double dangPrice;
	private String keywords;
	private int hasDeleted;
	private String productPic;
	

	// Constructors

	/** default constructor */
	public Product() {
	}

	/** minimal constructor */
	public Product(String productName, Double fixedPrice,
			Double dangPrice, int hasDeleted) {
		this.productName = productName;
		this.fixedPrice = fixedPrice;
		this.dangPrice = dangPrice;
		this.hasDeleted = hasDeleted;
	}

	/** full constructor */
	public Product( String productName, String description,
			Long addTime, Double fixedPrice, Double dangPrice, String keywords,
			int hasDeleted, String productPic) {
		this.productName = productName;
		this.description = description;
		this.addTime = addTime;
		this.fixedPrice = fixedPrice;
		this.dangPrice = dangPrice;
		this.keywords = keywords;
		this.hasDeleted = hasDeleted;
		this.productPic = productPic;
	}

	// Property accessors

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	public String getProductName() {
		return this.productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getAddTime() {
		return this.addTime;
	}
	
	private SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
	
	public String getAddTimeAsString(){
		Date date = new Date(addTime);
		return df.format(date);
	}

	public void setAddTime(Long addTime) {
		this.addTime = addTime;
	}

	public Double getFixedPrice() {
		return this.fixedPrice;
	}

	public void setFixedPrice(Double fixedPrice) {
		this.fixedPrice = fixedPrice;
	}

	public Double getDangPrice() {
		return this.dangPrice;
	}

	public void setDangPrice(Double dangPrice) {
		this.dangPrice = dangPrice;
	}

	public String getKeywords() {
		return this.keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public int getHasDeleted() {
		return this.hasDeleted;
	}

	public void setHasDeleted(int hasDeleted) {
		this.hasDeleted = hasDeleted;
	}

	public String getProductPic() {
		return this.productPic;
	}

	public void setProductPic(String productPic) {
		this.productPic = productPic;
	}

	public String toString() {
		return "Product [id:" + id + ", productName:" + productName + "]";
	}

}